package com.itheima.demo1Exception;

import java.text.SimpleDateFormat;
import java.util.Date;

public class ExceptionDemo5 {
    public static void main(String[] args){
//        目标：掌握异常的处理方案1：底层异常都抛出去给最外层调用者，最外层捕获异常记录异常相应合适信息给用户看
        System.out.println("==程序开始。。。==");
        try {
            show();
            System.out.println("操作成功");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("操作失败");
        }
        System.out.println("==程序结束。。。==");
    }
    public static void show() throws Exception {
        System.out.println("show1方法执行了");
        String str="2024-07-09 11:12:13";
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date=sdf.parse(str);
        System.out.println(date);
    }
}
